const routes = [
  {
    path: '/home',
    name: 'home',
    component: () => import('../views/HomeView.vue'),
    children: [
      {
        path: '/home/index',
        name: 'index',
        component: () => import('../views/home/index.vue'),
        meta: { title: '首页' },  //meta  路由元信息，永远跟着路由跳
      },
      {
        path: '/home/bbt',
        name: 'bbt',
        component: () => import('../views/home/bbt.vue'),
        meta: { title: '爆爆团' },
      },
      {
        path: '/home/order',
        name: 'order',
        component: () => import('../views/home/order.vue'),
        meta: { title: '订单' },
      },
      {
        path: '/home/mine',
        name: 'mine',
        component: () => import('../views/home/mine.vue'),
        meta: { title: '我的' },
      },

      {
        path: '/home',
        redirect: '/home/index'//重定向
      },
      {
        path: '*',
        component: () => import('../views/NotFound.vue')
      }
    ]
  },
  //登录
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/LoginView.vue'),
    meta: { title: '登录' },
  },
  // 注册
  {
    path: '/register',
    name: 'register',
    component: () => import('../views/RegisterView.vue'),
    meta: { title: '注册' },
  },
  // 商家店铺
  {
    path: '/shop/:id',
    name: 'shop',
    component: () => import('../views/ShopView.vue'),
    meta: { title: '店铺' },
  },
  //搜索
  {
    path: '/search',
    name: 'search',
    component: () => import('../views/SearchView.vue'),
    meta: { title: '搜索' },
  },
  // 收藏
  {
    path: '/favlist',
    name: 'favlist',
    component: () => import('../views/FavlistView.vue'),
    meta: { title: '收藏' },
  },
  // 地址列表
  {
    path: '/addresslist',
    name: 'addresslist',
    component: () => import('../views/AddressListView.vue'),
    meta: { title: '地址' },
  },
  // 新增地址
  {
    path: '/address',
    name: 'address',
    component: () => import('../views/AddressView.vue'),
    meta: { title: '新增地址' },
  },
  // 修改地址
  {
    path: '/addressEdit',
    name: 'addressEdit',
    component: () => import('../views/AddressView1.vue'),
    meta: { title: '修改地址' },
  },
  {
    path: '/',
    redirect: '/register'//重定向
  },
  {
    path: '*',
    component: () => import('../views/NotFound.vue'),
  }
]

export default routes;